/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.clientapi;

import com.jili.ubert.code.server2client.MsgResult;
import com.jili.ubert.code.server2client.Price;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 *
 * @author ChengJili
 */
class HistoryDataClientHanlder extends SimpleChannelInboundHandler<MsgEntity> {

    private final HistoryDataRequest client;

    public HistoryDataClientHanlder(HistoryDataRequest client) {
        this.client = client;
    }

    @Override
    protected void messageReceived(ChannelHandlerContext ctx, MsgEntity msg) throws Exception {
        if (msg == null) {
            return;
        }
        msg.setChannel(ctx.channel());
        ClientAPI.WorkRun(new Runnable() {

            @Override
            public void run() {
                client.AccpetSessionAnswer(msg.getSessionID(),msg);
            }
        });
        // int playerid = ServerCache.get(ctx.channel());
        /*
         int csCommondCode = msg.getCmdCode();
         byte[] data = msg.getData();
         switch (csCommondCode){
         case 0:{
         break;
         }

         default:{
         ClientAPI.WorkRun(new Runnable(){ 

         @Override
         public void run() {
         client.AccpetSessionAnswer(msg);
         }
         });
         break;
         }
         }
         */

    }

    MsgResult getLoginAnswer() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}
